package javase1.day10.demo07;

public class DemoComputer {
    public static void main(String[] args) {
        Computer computer=new Computer();
        computer.powerOn();
        //使用多态
        Usb usb1=new Mouse();
        computer.useDevise(usb1);
        Usb usb2=new Keyboard();
        computer.useDevise(usb2);
        System.out.println("===============");

        //不使用多态,直接匿名对象.自动的向上转型
        computer.useDevise(new Mouse());
//        computer.useDevise(new Keyboard());
        Keyboard keyboard=new Keyboard();
        computer.useDevise(keyboard);


        computer.powerOff();
    }
}
